<template>
	<view class="container">
		<userInfo></userInfo>
		<view class="title">共同生活成员家庭情况</view>
		<view class="topOptionsBox">
			<view class="topOptions" @click="chooseUser(index)" :class="chooseUserIndex == index?'chooseUser':''" v-for="(item,index) in list" :key="index">{{item.username?item.username:'姓名'}}</view>
			<view class="topOptions topOptionsButton" @click="addUser">
				+
			</view>
		</view>
		
		<view v-for="(item,index) in list" v-if="chooseUserIndex == index" :key="index">
			<!-- <image class="uploadFile" src="/static/kancha/uploadFile.png"></image> -->
			<view class="delBox">
				<view class="">
					
				</view>
				<view class="del" @click="delUser(item,index)">
					删除
				</view>
			</view>
			<view class="options">
				<view class="optionsLeft">姓名</view>
				<input type="text" v-if="!isOpen" placeholder-class="isEmpty" v-model="item.username" class="optionsRight" placeholder="请填写姓名"/>
				<view class="optionsRight" v-else :class="!item.username?'isEmpty':''">
					{{item.username?item.username:'请填写姓名'}}
				</view>
			</view>
			<picker mode="selector" :range="sexArr" @change="selectSex(index,$event)">
				<view class="options">
					<view class="optionsLeft">性别</view>
					<view class="optionsRight">
						<view class="personNum">{{sexArr[item.sex/1]}}</view>
						<image class="sanjia" src="/static/kancha/sanjiao.png"></image>
					</view>
				</view>
			</picker>
			<view class="options">
				<view class="optionsLeft">身份证号</view>
				<input type="text" v-if="!isOpen" :maxlength="18" v-model="item.identityNumber" placeholder-class="isEmpty" class="optionsRight" placeholder="请填写身份证号"/>
				<view class="optionsRight" v-else :class="!item.identityNumber?'isEmpty':''">
					{{item.identityNumber?item.identityNumber:'请填写身份证号'}}
				</view>
			</view>
			<view class="options">
				<view class="optionsLeft">居住证号</view>
				<input type="text" v-if="!isOpen"  v-model="item.residencePermitNumber" placeholder-class="isEmpty" class="optionsRight" placeholder="请填写居住证号"/>
				<view class="optionsRight" v-else :class="!item.residencePermitNumber?'isEmpty':''">
					{{item.residencePermitNumber?item.residencePermitNumber:'请填写居住证号'}}
				</view>
			</view>
			<picker mode="selector" range-key="dictLabel" :range="minzu" @change="selectChange('minzu',index,$event)">
				<view class="options">
					<view class="optionsLeft">民族</view>
					<view class="optionsRight">{{minzuObj[item.nationality+'']}}</view>
				</view>
			</picker>
			<picker mode="selector" range-key="dictLabel" :range="zhengzhimianmao" @change="selectChange('zhengzhimianmao',index,$event)">
			<view class="options">
				<view class="optionsLeft">政治面貌</view>
				<view class="optionsRight">
					<view class="personNum">{{zhengzhimianmaoObj[item.politicalStatus+'']}}</view>
					<image class="sanjia" src="/static/kancha/sanjiao.png"></image>
				</view>
			</view>
			</picker>
			<picker mode="selector" range-key="dictLabel" :range="wenhuachengdu" @change="selectChange('wenhuachengdu',index,$event)">
			<view class="options">
				<view class="optionsLeft">文化程度</view>
				<view class="optionsRight">
					<view class="personNum">{{wenhuachengduObj[item.educationLevel+'']}}</view>
					<image class="sanjia" src="/static/kancha/sanjiao.png"></image>
				</view>
			</view>
			</picker>
			<picker mode="selector" range-key="dictLabel" :range="hunyinzhuangkuang" @change="selectChange('hunyinzhuangkuang',index,$event)">
			<view class="options">
				<view class="optionsLeft">婚姻状况</view>
				<view class="optionsRight">
					<view class="personNum">{{hunyinzhuangkuangObj[item.maritalStatus+'']}}</view>
					<image class="sanjia" src="/static/kancha/sanjiao.png"></image>
				</view>
			</view>
			</picker>
			<picker mode="selector" range-key="dictLabel" :range="jiatingguanxi" @change="selectChange('jiatingguanxi',index,$event)">
			<view class="options">
				<view class="optionsLeft">家庭关系</view>
				<view class="optionsRight">
					<view class="personNum">{{jiatingguanxiObj[item.familyRelations+'']}}</view>
					<image class="sanjia" src="/static/kancha/sanjiao.png"></image>
				</view>
			</view>
			</picker>
			<picker mode="selector" range-key="dictLabel" :range="chengxiangshuxing" @change="selectChange('chengxiangshuxing',index,$event)">
			<view class="options">
				<view class="optionsLeft">城乡属性</view>
				<view class="optionsRight">
					<view class="personNum">{{chengxiangshuxingObj[item.urbanAndRuralAttributes+'']}}</view>
					<image class="sanjia" src="/static/kancha/sanjiao.png"></image>
				</view>
			</view>
			</picker>
			<view class="wordBox">
				<view class="wordOptions">
					<text>*</text>
					城区是指在市辖区和不设区的市，区、市政府驻地的实际建设连接到的居民委员会和其他区域。
				</view>
				<view class="wordOptions">
					<text>*</text>
					镇区是指在城区以外的县人民政府驻地和其他镇政府驻地的实际建设连接到的居民委员和其他区域。与政府驻地的实际建设不连接，且常住人口在3000人以上的独立的工矿区、开发区等特殊区域及农场、林场的场部驻地视为镇区。
				</view>
				<view class="wordOptions">
					<text>*</text>
					农村指城镇以外的区域。
				</view>
			</view>
			<picker mode="selector" range-key="dictLabel" :range="shentizhuangkuang" @change="selectChange('shentizhuangkuang',index,$event)">
			<view class="options">
				<view class="optionsLeft">身体状况</view>
				<view class="optionsRight">
					<view class="personNum">{{shentizhuangkuangObj[item.physicalConditions+'']}}</view>
					<image class="sanjia" src="/static/kancha/sanjiao.png"></image>
				</view>
			</view>
			</picker>
			<picker mode="selector" range-key="dictLabel" :range="laodongnengli" @change="selectChange('laodongnengli',index,$event)">
			<view class="options">
				<view class="optionsLeft">劳动能力</view>
				<view class="optionsRight">
					<view class="personNum">{{laodongnengliObj[item.workCapacity+'']}}</view>
					<image class="sanjia" src="/static/kancha/sanjiao.png"></image>
				</view>
			</view>
			</picker>
			<picker mode="selector" range-key="dictLabel" :range="huanbingbingzhong" @change="selectChange('huanbingbingzhong',index,$event)">
			<view class="options">
				<view class="optionsLeft">患病病种</view>
				<view class="optionsRight">
					<view class="personNum">{{huanbingbingzhongObj[item.diseaseType+'']}}</view>
					<image class="sanjia" src="/static/kancha/sanjiao.png"></image>
				</view>
			</view>
			</picker>
			<view class="options" v-if="huanbingbingzhongObj[item.diseaseType+''] == '其他'">
				<view class="optionsLeft">手动填写（病种）</view>
				<input type="text" v-if="!isOpen"  v-model="item.otherDisease" placeholder-class="isEmpty" class="optionsRight" placeholder="请填写具体病种"/>
				<view class="optionsRight" v-else :class="!item.otherDisease?'isEmpty':''">
					{{item.otherDisease?item.otherDisease:'请填写具体病种'}}
				</view>
			</view>
			<picker mode="selector" range-key="dictLabel" :range="canjileibie" @change="selectChange('canjileibie',index,$event)">
			<view class="options">
				<view class="optionsLeft">残疾类别</view>
				<view class="optionsRight">
					<view class="personNum">{{canjileibieObj[item.disabilityCategory+'']}}</view>
					<image class="sanjia" src="/static/kancha/sanjiao.png"></image>
				</view>
			</view>
			</picker>
			<picker mode="selector" range-key="dictLabel" :range="canjidengji" @change="selectChange('canjidengji',index,$event)">
			<view class="options">
				<view class="optionsLeft">残疾等级</view>
				<view class="optionsRight">
					<view class="personNum">{{canjidengjiObj[item.disabilityLevel+'']}}</view>
					<image class="sanjia" src="/static/kancha/sanjiao.png"></image>
				</view>
			</view>
			</picker>
			<picker mode="selector" range-key="dictLabel" :range="shenfenleibie" @change="selectChange('shenfenleibie',index,$event)">
			<view class="options">
				<view class="optionsLeft">身份类别</view>
				<view class="optionsRight">
					<view class="personNum">{{shenfenleibieObj[item.identityCategory+'']}}</view>
					<image class="sanjia" src="/static/kancha/sanjiao.png"></image>
				</view>
			</view>
			</picker>
			<picker mode="selector" range-key="dictLabel" :range="jiuyeqingkuang" @change="selectChange('jiuyeqingkuang',index,$event)">
			<view class="options">
				<view class="optionsLeft">就业情况</view>
				<view class="optionsRight">
					<view class="personNum">{{jiuyeqingkuangObj[item.employmentStatus+'']}}</view>
					<image class="sanjia" src="/static/kancha/sanjiao.png"></image>
				</view>
			</view>
			</picker>
			<picker mode="selector" range-key="dictLabel" :range="jiuxueqingkuang" @change="selectChange('jiuxueqingkuang',index,$event)">
			<view class="options">
				<view class="optionsLeft">就学情况</view>
				<view class="optionsRight">
					<view class="personNum">{{jiuxueqingkuangObj[item.schoolAttendance+'']}}</view>
					<image class="sanjia" src="/static/kancha/sanjiao.png"></image>
				</view>
			</view>
			</picker>
			<picker mode="date" v-if="jiuxueqingkuangObj[item.schoolAttendance+''] == '在读'" :value="item.graduationTime" @change="changeDateTime($event,index)">
			<view class="options">
				<view class="optionsLeft">毕业时间</view>
				<view class="optionsRight" :class="!item.graduationTime?'isEmpty':''">
					{{item.graduationTime?item.graduationTime:'请选择毕业时间'}}
				</view>
			</view>
			</picker>
		</view>
		<view class="bottomOptions" v-if="list.length>0">
			<view class="bottomTitle">保险情况</view>
			<view class="bottomOptionsBox">
				<view class="bottomOptionsBoxIn" @click="chooseBaoxian(itemIn)" v-for="(itemIn,index) in baoxian" :key="index">
					<image class="chooseIcon" v-if="itemIn.isCheck" src="/static/kancha/choose.png"></image>
					<image class="chooseIcon" v-else src="/static/kancha/nochoose.png"></image>
					<view class="bottomOptionsTitle">{{itemIn.dictLabel}}</view>
				</view>
			</view>
		</view>
		<!-- <view class="button1" @click="save">
			提交
		</view> -->
		<view class="button" v-if="isSave == '0'" @click="save(true)">
			下一步
		</view>
		<view class="zhenchayuan">侦查员——{{user.nickName?user.nickName:user.userName}}</view>
		<view class="bottom"></view>
		<otherList @openChange="isOpenChange"/>
	</view>
</template>

<script>
	import otherList from '@/pages/components/otherInfoList.vue'
	import userInfo from '@/pages/components/userInfo.vue'
	let outData = {
		chooseUserIndex:0,
		isOpen:true
	}
	function dateFormat(fmt, date) {
	    let ret;
	    const opt = {
	        "Y+": date.getFullYear().toString(),        // 年
	        "m+": (date.getMonth() + 1).toString(),     // 月
	        "d+": date.getDate().toString(),            // 日
	        "H+": date.getHours().toString(),           // 时
	        "M+": date.getMinutes().toString(),         // 分
	        "S+": date.getSeconds().toString()          // 秒
	        // 有其他格式化字符需求可以继续添加，必须转化成字符串
	    };
	    for (let k in opt) {
	        ret = new RegExp("(" + k + ")").exec(fmt);
	        if (ret) {
	            fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
	        };
	    };
	    return fmt;
	}
	let info = {
			"guaranteeNumber": "",
			"username": "",
			"identityNumber": "",
			"sex": 1,
			"residencePermitNumber": "",
			"nationality": 1,
			"politicalStatus": 0,
			"educationLevel": 0,
			"maritalStatus": 0,
			"familyRelations": 0,
			"urbanAndRuralAttributes": 0,
			"physicalConditions": 0,
			"workCapacity": 0,
			"diseaseType": 0,
			"disabilityCategory": 0,
			"disabilityLevel": 0,
			"identityCategory": 0,
			"employmentStatus": 0,
			"schoolAttendance": 0,
			"insuranceSituation": 0,
			graduationTime:dateFormat("YYYY-mm-dd HH:MM", new Date()).split(' ')[0],
			otherDisease:'无',
			"photo": "hppt://pic.com"
		}
	export default {
		components:{
			otherList,userInfo
		},
		data(){
			return Object.assign(outData,JSON.parse(JSON.stringify(this.dataObject)),{
				list:[],
				isOpen:false,
				user:{},
				sexArr:["女","男"],
				minzu:[],
				minzuObj:{},
				zhengzhimianmao:[],
				zhengzhimianmaoObj:{},
				wenhuachengdu:[],
				wenhuachengduObj:{},
				hunyinzhuangkuang:[],
				hunyinzhuangkuangObj:{},
				jiatingguanxi:[],
				jiatingguanxiObj:{},
				chengxiangshuxing:[],
				chengxiangshuxingObj:{},
				shentizhuangkuang:[],
				shentizhuangkuangObj:{},
				laodongnengli:[],
				laodongnengliObj:{},
				huanbingbingzhong:[],
				huanbingbingzhongObj:{},
				canjileibie:[],
				canjileibieObj:{},
				canjidengji:[],
				canjidengjiObj:{},
				shenfenleibie:[],
				shenfenleibieObj:{},
				jiuyeqingkuang:[],
				jiuyeqingkuangObj:{},
				jiuxueqingkuang:[],
				jiuxueqingkuangObj:{},
				baoxian:[],
				isSave:'1',
				pageInfo:{
					pageName:'共同生活成员情况',
					pagePath:'/pages/kancha/familyMemberInfo',
					pageIndex:1
				}
			})
		},
		computed:{
			
		},
		onLoad() {
			this.isSave = uni.getStorageSync('isSave')
			this.user = uni.getStorageSync('user')
			this.getDetail()
		},
		methods: {
			changeDateTime(e,index){
				this.list[index].graduationTime = e.target.value
				console.log(this.list)
			},
			// 表单验证
			verifyData(){
				let arr = this.list
				let length = arr.length
				for(let i=0;i<length;i++){
					// 验证姓名
					if(this.$verifyEmpty(arr[i].username)){
						return {
							title:'请填写第 '+(i+1)+' 名同住人姓名信息',
							status:false
						}
					}
					// 验证身份证号
					if(!this.$verifyIdCard(arr[i].identityNumber)&&this.$verifyEmpty(arr[i].residencePermitNumber)){
						if(!this.$verifyIdCard(arr[i].identityNumber)){
							return {
								title:'第 '+(i+1)+' 名同住人身份证好不正确',
								status:false
							}
						}
						if(this.$verifyEmpty(arr[i].residencePermitNumber)){
							return {
								title:'第 '+(i+1)+' 名同住人居住证号不能为空',
								status:false
							}
						}
					}
					// 验证居住证号
					// if(this.$verifyEmpty(arr[i].residencePermitNumber)){
					// 	return {
					// 		title:'第 '+(i+1)+' 名同住人居住证号不能为空',
					// 		status:false
					// 	}
					// }
					// 验证毕业时间
					if(arr[i].schoolAttendance == 0&&this.$verifyEmpty(arr[i].graduationTime)){
						return {
							title:'第 '+(i+1)+' 名同住人毕业时间不能为空',
							status:false
						}
					}
					// 检测患病兵种
					if(this.huanbingbingzhongObj[arr[i].diseaseType+''] == '其他'&&this.$verifyEmpty(arr[i].otherDisease)){
						return {
							title:'第 '+(i+1)+' 名同住人病种手填项不能为空',
							status:false
						}
					}
				}
				return {
					title:'验证通过',
					status:true
				}
			},
			// 民族选择
			selectMinzu(index,e){
				console.log(e)
				this.list[index].nationality = e.detail.value/1
			},
			// 性别选择
			selectSex(index,e){
				this.list[index].sex = e.detail.value/1
			},
			// 获取共同生活成员家庭情况
			async getDetail(){
				uni.showLoading({
					title:'请稍等...'
				})
				let memberInfoList = await this.$get('/app/bus/indexMember?guaranteeNumber='+uni.getStorageSync('guaranteeNumber'),{}) 
				if(memberInfoList.code == 200){
					console.log(memberInfoList)
					this.list = memberInfoList.data
					// if(memberInfoList.data.length == 0){
					// 	let _info = {...info}
					// 	_info.guaranteeNumber = uni.getStorageSync('guaranteeNumber');
					// 	this.list = [JSON.parse(JSON.stringify(_info))]
					// } 
					// else {
					// 	this.list = memberInfoList.data
					// }
				}
				// 获取民族
				let minzuArr = await this.$get('/app/bus/dictType?dictType=minzu',{})
				if(minzuArr.code == 200){
					this.minzu = minzuArr.data
					this.minzu.forEach(item=>{
						this.minzuObj[item.dictValue]=item.dictLabel
					})
				}
				console.log(this.minzuObj)
				// 获取政治面貌数组 
				let zhengzhimianmaoArr = await this.$get('/app/bus/dictType?dictType=political_status',{})
				if(zhengzhimianmaoArr.code == 200){
					this.zhengzhimianmao = zhengzhimianmaoArr.data
					this.zhengzhimianmao.forEach(item=>{
						this.zhengzhimianmaoObj[item.dictValue]=item.dictLabel
					})
				}
				// 获取文化程度数组
				let wenhuachengduArr = await this.$get('/app/bus/dictType?dictType=education_status',{})
				if(wenhuachengduArr.code == 200){
					this.wenhuachengdu = wenhuachengduArr.data
					this.wenhuachengdu.forEach(item=>{
						this.wenhuachengduObj[item.dictValue]=item.dictLabel
					})
				}
				
				// 获取婚姻状况数组
				let hunyinzhuangkuangArr = await this.$get('/app/bus/dictType?dictType=marital_status',{})
				if(hunyinzhuangkuangArr.code == 200){
					this.hunyinzhuangkuang = hunyinzhuangkuangArr.data
					this.hunyinzhuangkuang.forEach(item=>{
						this.hunyinzhuangkuangObj[item.dictValue]=item.dictLabel
					})
				}
				
				// 获取家庭关系数组
				let jiatingguanxiArr = await this.$get('/app/bus/dictType?dictType=family_relationships_status',{})
				if(jiatingguanxiArr.code == 200){
					this.jiatingguanxi = jiatingguanxiArr.data
					this.jiatingguanxi.forEach(item=>{
						this.jiatingguanxiObj[item.dictValue]=item.dictLabel
					})
				}
				
				// 获取城乡属性数组
				let chengxiangshuxingArr = await this.$get('/app/bus/dictType?dictType=urban_and_rural_attributes',{})
				if(chengxiangshuxingArr.code == 200){
					this.chengxiangshuxing = chengxiangshuxingArr.data
					this.chengxiangshuxing.forEach(item=>{
						this.chengxiangshuxingObj[item.dictValue]=item.dictLabel
					})
				}
				
				// 获取身体状况数组
				let shentizhuangkuangArr = await this.$get('/app/bus/dictType?dictType=physical_conditions',{})
				if(shentizhuangkuangArr.code == 200){
					this.shentizhuangkuang = shentizhuangkuangArr.data
					this.shentizhuangkuang.forEach(item=>{
						this.shentizhuangkuangObj[item.dictValue]=item.dictLabel
					})
				}
				// 获取劳动能力数组
				let laodongnengliArr = await this.$get('/app/bus/dictType?dictType=work_capacity',{})
				if(laodongnengliArr.code == 200){
					this.laodongnengli = laodongnengliArr.data
					this.laodongnengli.forEach(item=>{
						this.laodongnengliObj[item.dictValue]=item.dictLabel
					})
				}
				// 获取患病兵种数组
				let huanbingbingzhongArr = await this.$get('/app/bus/dictType?dictType=disease_type',{})
				if(huanbingbingzhongArr.code == 200){
					this.huanbingbingzhong = huanbingbingzhongArr.data
					this.huanbingbingzhong.forEach(item=>{
						this.huanbingbingzhongObj[item.dictValue]=item.dictLabel
					})
				}
				// 获取残疾类别数组
				let canjileibieArr = await this.$get('/app/bus/dictType?dictType=disability_category',{})
				if(canjileibieArr.code == 200){
					this.canjileibie = canjileibieArr.data
					this.canjileibie.forEach(item=>{
						this.canjileibieObj[item.dictValue]=item.dictLabel
					})
				}
				// 获取残疾等级数组
				let canjidengjiArr = await this.$get('/app/bus/dictType?dictType=disability_level',{})
				if(canjidengjiArr.code == 200){
					this.canjidengji = canjidengjiArr.data
					this.canjidengji.forEach(item=>{
						this.canjidengjiObj[item.dictValue]=item.dictLabel
					})
				}
				// 获取身份类别数组
				let shenfenleibieArr = await this.$get('/app/bus/dictType?dictType=identity_category',{})
				if(shenfenleibieArr.code == 200){
					this.shenfenleibie = shenfenleibieArr.data
					this.shenfenleibie.forEach(item=>{
						this.shenfenleibieObj[item.dictValue]=item.dictLabel
					})
				}
				// 获取就业情况数组
				let jiuyeqingkuangArr = await this.$get('/app/bus/dictType?dictType=employment_status',{})
				if(jiuyeqingkuangArr.code == 200){
					this.jiuyeqingkuang = jiuyeqingkuangArr.data
					this.jiuyeqingkuang.forEach(item=>{
						this.jiuyeqingkuangObj[item.dictValue]=item.dictLabel
					})
				}
				// 获取就学情况数组
				let jiuxueqingkuangArr = await this.$get('/app/bus/dictType?dictType=attendance',{})
				if(jiuxueqingkuangArr.code == 200){
					this.jiuxueqingkuang = jiuxueqingkuangArr.data
					this.jiuxueqingkuang.forEach(item=>{
						this.jiuxueqingkuangObj[item.dictValue]=item.dictLabel
					})
				}
				//获取保险情况
				let baoxianArr = await this.$get('/app/bus/dictType?dictType=insurance_situation',{})
				if(baoxianArr.code == 200){
					let insuranceSituation = []
					if(this.list.length>0&&this.list[0].insuranceSituation){
						insuranceSituation = (this.list[0].insuranceSituation+'').split(',')
					}
					baoxianArr.data.forEach(item=>{
						item.isCheck = false
					})
					baoxianArr.data.forEach(item=>{
						insuranceSituation.forEach(itemIn=>{
							if(item.dictValue == itemIn){
								item.isCheck = true
							}
						})
					})
					this.baoxian = baoxianArr.data
				}
				uni.hideLoading()
			},
			// 基本信息开关
			isOpenChange(e){
				this.isOpen = e
				if(e){
					this.save(false,true)
				}
			},
			async save(isLink,isChangeOpen){
				if(isChangeOpen&&this.list.length == 0){
					return
				}
				if(this.list.length == 0){
					this.link()
					return
				}
				let result = this.verifyData()
				if(isLink){
					if(!result.status){
						uni.showModal({
							content: result.title,
							showCancel: false,
							confirmText: '确定'
						});
						return
					}
				}
				uni.showLoading({
					title:'请稍等...'
				})
				let res = await this.$post('/app/bus/saveMember',JSON.stringify(this.list),false)
				
				if(res.code == 200){
					console.log(isLink)
					let pageStatus = uni.getStorageSync('pageStatus')
					if(result.status){
						pageStatus.familyMemberInfo = {
							...this.pageInfo,
							status:true
						}
					} else {
						pageStatus.familyMemberInfo = {
							...this.pageInfo,
							status:false
						}
					}
					uni.setStorageSync('pageStatus',pageStatus)
					if(isLink){
						this.link()
					} else {
						// uni.showToast({
						// 	title: '信息修改成功',
						// 	duration:2000
						// });
					}
				}
				uni.hideLoading()
			},
			link() {
				uni.redirectTo({
					url: '/pages/kancha/notFamilyMemberInfo'
				})
			},
			selectChange(e,index,str){
				// 民族
				if(e == 'minzu'){
					this.list[index].nationality = this[e][str.detail.value].dictValue/1
				}
				// 政治面貌
				if(e == 'zhengzhimianmao'){
					this.list[index].politicalStatus = this[e][str.detail.value].dictValue/1
				}
				// 文化程度
				if(e == 'wenhuachengdu'){
					this.list[index].educationLevel = this[e][str.detail.value].dictValue/1
				}
				// 婚姻状况
				if(e == 'hunyinzhuangkuang'){
					this.list[index].maritalStatus = this[e][str.detail.value].dictValue/1
				}
				// 家庭关系
				if(e == 'jiatingguanxi'){
					this.list[index].familyRelations = this[e][str.detail.value].dictValue/1
				}
				// 城乡属性
				if(e == 'chengxiangshuxing'){
					this.list[index].urbanAndRuralAttributes = this[e][str.detail.value].dictValue/1
				}
				// 身体状况
				if(e == 'shentizhuangkuang'){
					this.list[index].physicalConditions = this[e][str.detail.value].dictValue/1
				}
				// 劳动能力
				if(e == 'laodongnengli'){
					this.list[index].workCapacity = this[e][str.detail.value].dictValue/1
				}
				// 患病兵种
				if(e == 'huanbingbingzhong'){
					this.list[index].diseaseType = this[e][str.detail.value].dictValue/1
				}
				// 残疾类别
				if(e == 'canjileibie'){
					this.list[index].disabilityCategory = this[e][str.detail.value].dictValue/1
				}
				// 残疾等级
				if(e == 'canjidengji'){
					this.list[index].disabilityLevel = this[e][str.detail.value].dictValue/1
				}
				// 身份类别
				if(e == 'shenfenleibie'){
					this.list[index].identityCategory = this[e][str.detail.value].dictValue/1
				}
				// 就业情况
				if(e == 'jiuyeqingkuang'){
					this.list[index].employmentStatus = this[e][str.detail.value].dictValue/1
				}
				// 就学情况
				if(e == 'jiuxueqingkuang'){
					this.list[index].schoolAttendance = this[e][str.detail.value].dictValue/1
				}
			},
			chooseBaoxian(item){
				// let a = item.isCheck
				item.isCheck = !item.isCheck
				let arr = []
				this.baoxian.forEach(itemIn=>{
					if(itemIn.isCheck){
						arr.push(itemIn.dictValue)
					}
				})
				this.list[this.chooseUserIndex].insuranceSituation = arr.join(',')
			},
			chooseUser(index){
				this.chooseUserIndex = index
				let insuranceSituation = []
				if(this.list[index].insuranceSituation){
					insuranceSituation = (this.list[index].insuranceSituation+'').split(',')
				}
				this.baoxian.forEach(item=>{
					item.isCheck = false
				})
				this.baoxian.forEach(item=>{
					insuranceSituation.forEach(itemIn=>{
						if(item.dictValue == itemIn){
							item.isCheck = true
						}
					})
				})
			},
				addUser(){
					let _info = {...info}
					_info.guaranteeNumber = uni.getStorageSync('guaranteeNumber');
					this.list.push(Object.assign(JSON.parse(JSON.stringify(_info)),JSON.parse(JSON.stringify(this.dataObject))))
				},
			async delUser(item,index){
				uni.showModal({
					content: '确认要要删除本条记录吗？',
					showCancel: true,
					cancelText: '取消',
					confirmText: '确认',
					success: async res => {
						if(res.confirm){
							if(item.id){
								let resIn = await this.$get('/app/bus/delMember?id='+item.id,{})
								console.log(resIn)
								if(resIn.code == 200){
									this.list.splice(index,1)
									if(this.chooseUserIndex!=0){
										this.chooseUserIndex--
									}
								} else {
									uni.showToast({
										title: '删除失败',
										icon:'none',
										duration:2000
										
									});
								}
							} else {
								this.list.splice(index,1)
								if(this.chooseUserIndex!=0){
									this.chooseUserIndex--
								}
							}
						}
					},
					fail: () => {},
					complete: () => {}
				});
			}
		}
	}
</script>
<style>
	page {
		background: white;
	}
</style>
<style scoped>
	.delBox{
		display: flex;
		justify-content: space-between;
		padding:0 40rpx;
	}
	.del{
		width: 100rpx;
		line-height: 60rpx;
		text-align: center;
		color: white;
		background-color: #fa5444;
		border-radius: 5rpx;
	}
	.topOptionsBox{
		display: flex;
		flex-wrap: wrap;
		width: 680rpx;
		margin-top: 20rpx;
		border-top:1rpx solid #ccc;
		margin: 0 auto;
	}
	.topOptions{
		line-height: 90rpx;
		color: #ccc;
		font-size: 26rpx;
		font-size: 32rpx;
		font-weight: 700;
		margin-right: 30rpx;
		border-top:1rpx solid transparent;
	}
	.topOptionsButton{
		background-color: white;
		font-size: 40rpx;
		width: 80rpx;
		text-align: center;
	}
	.chooseUser{
		border-top:1rpx solid #f75443;
		color:#333;
	}
	.title {
		font-size: 36rpx;
		font-weight: 700;
		color: #fa5245;
		line-height: 1;
		text-align: center;
		padding-bottom: 20rpx;
		padding-top: 50rpx;
	}

	.options {
		width: 670rpx;
		border-radius: 6rpx;
		border: 1rpx solid #ccc;
		display: flex;
		align-items: center;
		height: 86rpx;
		padding: 0 40rpx;
		margin: 0 auto;
		margin-top: 30rpx;
		justify-content: space-between;
	}

	.optionsLeft {
		font-size: 30rpx;
		color: #ccc;
	}

	.optionsBottomTitle {
		font-size: 30rpx;
		color: #ccc;
	}

	.optionsRight {
		display: flex;
		align-items: center;
		font-size: 30rpx;
		text-align: right;
	}

	.optionsBottomBottom {
		font-size: 30rpx;
		margin-top: 20rpx;
	}

	.position {
		max-width: 360rpx;
	}

	.positionIcon {
		width: 27rpx;
		height: 38rpx;
		margin-left: 25rpx;
	}

	.sanjia {
		width: 23rpx;
		height: 18rpx;
		margin-left: 20rpx;
	}

	.kongge {
		width: 20rpx;
	}

	.optionsBottomBox {
		width: 670rpx;
		border-radius: 6rpx;
		border: 1rpx solid #ccc;
		padding: 20rpx 40rpx;
		margin: 0 auto;
		margin-top: 30rpx;
	}

	.line {
		height: 26rpx;
		background: #f7f7f7;
		margin-top: 30rpx;
	}

	.uploadFile {
		width: 184rpx;
		height: 143rpx;
		margin: 0 auto;
		margin-top: 10rpx;
	}

	.wordBox {
		padding: 20rpx 80rpx;
	}

	.wordBox text {
		color: #fa5245;
	}

	.wordOptions {
		font-size: 22rpx;
		color: #ccc;
	}

	.bottomOptions {
		width: 670rpx;
		padding: 20rpx 40rpx;
		margin: 0 auto;
		margin-top: 30rpx;
		border: 1rpx solid #ccc;
		border-radius: 6rpx;
	}

	.bottomTitle {
		color: #ccc;
	}

	.bottomOptionsBox {
		margin-top: 20rpx;
		display: flex;
		flex-wrap: wrap;
	}

	.bottomOptionsBoxIn {
		width: 290rpx;
		display: flex;
		align-items: center;
		height: 45rpx;
	}

	.chooseIcon {
		width: 28rpx;
		height: 27rpx;
	}

	.bottomOptionsTitle {
		margin-left: 28rpx;
	}

	.button1{
		width:570rpx;
		line-height:84rpx;
		text-align:center;
		margin:0 auto;
		margin-top:50rpx;
		border-radius:6rpx;
		background:#656668;
		font-size:28rpx;
		color:white;
	}
	.button{
		width:570rpx;
		line-height:84rpx;
		text-align:center;
		margin:0 auto;
		margin-top:50rpx;
		border-radius:6rpx;
		background:linear-gradient(90deg,#fa5444,#ff988f);
		font-size:28rpx;
		color:white;
		
	}
	.zhenchayuan{
		font-size: 24rpx;
		color:#ccc;
		margin-top: 20rpx;
		text-align: center;
	}
	.bottom{
		height:160rpx;
	}
	.topTitleBox{
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 40rpx;
		height: 90rpx;
	}
	.listTiteBox {
		position: relative;
	}
	
	.listTitleBackground {
		height: 16rpx;
		width: 120rpx;
		position: absolute;
		bottom: 0;
		right: 0;
		background: linear-gradient(-90deg, #ffd356, #ffffff)
	}
	.listTitle{
		font-size:38rpx;
		position: relative;
	}
	.right {
		width: 34rpx;
		height: 34rpx;
		position: relative;
		transition: all 0.3s;
	}
	.childrenBox{
		width: 600rpx;
		margin: 0 auto;
		height: 0;
		position: relative;
		transition: all 0.3s;
		overflow: hidden;
	}
	.childrenOptionsBox{
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
		padding: 20rpx 0;
	}
	.childrenOptionsTitle{
		font-size: 26rpx;
		line-height: 30rpx;
		color: #ccc;
	}
	.childrenOptionsDes{
		font-size: 26rpx;
		line-height: 30rpx;
		width: 450rpx;
		text-align: right;
	}
	.rightOpen{
		transform: rotate(90deg);
	}
	.line1{
		height: 20rpx;
		background-color: #efefef;
	}
	.otherInfo{
		width: 200rpx;
		line-height:70rpx;
		text-align: center;
		font-size: 24rpx;
		color:white;
		border-radius: 35rpx 0 0 35rpx;
		background-color: #3b3b3b;
		position: fixed;
		right: 0;
		top:460rpx;
		font-family: '黑体';
	}
	.isEmpty{
		color: #ccc;
	}
</style>
